import chat_data from "./chat_data";

export const queryMyMessages = (self) => {
  let params = {};
  params.pageNum = chat_data.tPage.pageNum;
  params.pageSize = chat_data.tPage.pageSize;
  self.isLoading = true;
  // self.$Spin.show();
  self.$apiChat.queryMessageStatusList(params).then(response => {
    // self.$Spin.hide();
    self.isLoading = false;
    self.refreshTime = 60;
    chat_data.tData.statusList.splice(0);
    if(response.success) {
      let page = response.result;
      chat_data.tPage.total = page.total;
      chat_data.tData.statusList.push(...page.list);
    }else{
      console.error(response);
      self.$Message.error("会话列表查询失败:"+response.errorMessage);
    }
  }).catch(() => {
    // self.$Spin.hide();
    self.isLoading = false;
    self.refreshTime = 60;
    console.error("查询失败");
    self.$Message.error("会话列表查询失败！");
    chat_data.tData.statusList.splice(0);
  })
}
